<?php 

namespace Admin\Controller;
use Think\Controller;
class TypeController extends BaseController{

public function TypeList(){

            $typeModel=M('type');
            $type=$typeModel->order('tid')->select();
            $this->type=$type;
            $this->display();          
}
public function deluser($id){
        //$id = $_GET['id'];
    $typeModel=M('type');
    $res=$typeModel->where("tid=$id")->find();
    //echo $res->getLastSql();
       $photoPath=realpath('./Public/Admin/photo/'.$res['photo']);
        if($res['photo']!=='default.jpg')
        {
        unlink($photoPath);}

    if(false!==$typeModel->where("tid=$id")->delete())
        $this->success('删除成功！');
    else
        { $this->error('删除失败');
    }
       
}




}


 ?>